Action Adds the table referred to by expression1 to the local context so that items in that table can be named directly, without including the table name.
Repeats the precess for the remaining expressions, if provided, to add more tables to the local context.
Examples app.start ("BarChart") «start up the BarChart application
with BarChart
newWindow (4, "Temperatures in Woodside", "° F")
setBar (1, "Jan", 54) «set the label of bar 1 to Jan, value to 54
setBar (2, "Apr", 67)
setBar (3, "Jul", 82)
setBar (4, "Oct", 73)
In this example, a sequence of BarChart verbs are called, but the with statement allows the “BarChart.” portion of the verbs’ paths to be omitted.
with objectModel, Excel
set (cell ["R1C1"].font, "Times")
Here, the with statement provides the required context to define the verb "set", as well as the terms "cell" and "font". This construction is typical of scripts that drive applications that use the object model protocol.
Notes • Each item in the with statement can be a simple name, a dotted name, a dereferenced address, or any other expression that specifies an existing table. The expressions can rely on the context of the previous item having been set up.
• With statements can specify up to seven tables, and can be nested. If the same name is defined in more than one table, the table that appears later in a with statement will take precedence.
• With statements can also be used to specify an object in an object-model application. See the “Scripting the Object Model” document for details.